package util.comparator;

import java.text.Collator;
import java.util.Comparator;

/**
 * implementation of comparator by Money value
 * 
 * @author Majid Mallis
 * 
 */
public class ComparatorByMoney implements Comparator<String> {

	public ComparatorByMoney() {
		super();
	}

	public int compare(String s1, String s2) {
		// if sizes are equal, we compare alphabetically
		if (s1.length() == s2.length()) {
			return Collator.getInstance().compare(s1, s2);
		}

		return s1.length() - s2.length();
	}
}